import React, { Component } from 'react'
import theme1 from './css/page1.module.css'
import theme2 from './css/page2.module.css'
export default class Page1 extends Component {
    constructor(){
        super();
        this.state={
            theme:theme1,
            mystyle:{
                color:"red"
            }
        }
    }
    setstyle=(e)=>{
        this.setState({
            theme:this.state.theme===theme1?theme2:theme1,
        })
       if(e.target.style.color==="red"){
            e.target.style.color="yellow"
       }else{
        e.target.style.color="red"
       }
    }
  render() {
    return (
      <React.Fragment>
        <div className={this.state.theme.active}>
          我是page1的样式
          <button onClick={(e)=>{this.setstyle(e)}} style={this.state.mystyle}>点击改变样式</button>
        </div>

      </React.Fragment>
    )
  }
}
